from django.db import models

# Create your models here.


#护林员信息
class Ranger(models.Model):
    uid = models.IntegerField('uid_护林员id',primary_key=True)
    name = models.CharField('name_姓名',max_length=20,default='-')
    sex = models.CharField('sex_性别',max_length=10,default='-')
    photo = models.CharField('photo',max_length=100,default='/')
    start = models.CharField('start_入职时间',max_length=50,default='-')
    years = models.IntegerField('years_年龄',default=0)
    status = models.CharField('status_状态',max_length=20,default='在岗')
    phone = models.CharField('phone_电话',max_length=15,default='-')
    info = models.TextField('info_其他信息',default='-')
    mid = models.IntegerField('mid_所属管理员',default=2)
    num = models.IntegerField('num_任务数',default=0)
    class Meta:
        verbose_name = 'Ranger_护林员信息'

#管理员信息表
class Manageuser(models.Model):
    uid = models.IntegerField('uid_管理员id',primary_key=True)
    name = models.CharField('name_管理员姓名',max_length=20,default='-')
    manrange = models.TextField('manrange_下属护林员',default='-')
    info = models.TextField('info_管理员基础信息',default='-')
    class Meta:
        verbose_name = 'Manageuser_管理员信息'

#管理员登录信息表
class Managelogin(models.Model):
    uid = models.IntegerField('uid_管理员工号',primary_key=True)
    password = models.CharField('possword_密码',max_length=100,default='123456')
    token = models.CharField('token_临时token',max_length=100,default='aann')
    mfile = models.TextField('mfile_调度记录',default='{}')
    class Meta:
        verbose_name = 'Managelogin_管理员登陆信息'

#超级管理员信息及登录
class Supuser(models.Model):
    uid = models.IntegerField('uid_超级管理员id',primary_key=True)
    name = models.CharField('name_超级管理员',max_length=20,default='-')
    password = models.CharField('password_密码',max_length=100,default='123456')
    info = models.TextField('info_超级管理员信息',default='-')
    token = models.CharField('token_临时token',max_length=100,default='aann')
    class Meta:
        verbose_name = 'Supuser_超级管理员信息及登录'








#地图表
class Map(models.Model):
    id = models.IntegerField('id_地图id',primary_key=True)
    name = models.CharField('name_地图英文名',max_length=30,default='-')
    title = models.CharField('title_地图中文名',max_length=20,default='-')
    img = models.CharField('img_大图路径',max_length=100,default='-')
    size_w = models.IntegerField('size_w_宽',default=0)
    size_h = models.IntegerField('size_h_高', default=0)
    layerurl = models.CharField('layerurl_切片路径',max_length=100,default='-')
    layers = models.IntegerField('layers_切片层数',default=0)
    class Meta:
        verbose_name = 'Map_地图表'

#大类表
class Group(models.Model):
    id = models.IntegerField('id_大类id',primary_key=True)
    name = models.CharField('name_大类英文名',max_length=30,default='-')
    title = models.CharField('title_大类中文名',max_length=20,default='-')
    mid = models.IntegerField('mid_所属地图',default=0)
    class Meta:
        verbose_name = 'Group_大类表'

#小类表
class Category(models.Model):
    id = models.IntegerField('id_小类id',primary_key=True)
    name = models.CharField('name_小类英文名',max_length=30,default='-')
    title = models.CharField('title_小类中文名',max_length=20,default='-')
    iconurl = models.CharField('iconurl_图标路径',max_length=100,default='-')
    shadowurl = models.CharField('shadowurl_图标背景路径',max_length=100,default='-')
    cluster = models.BooleanField('cluster_是否可聚合',default=False)
    status = models.BooleanField('status_状态',default=False)
    gid = models.IntegerField('dig_所属大类',default=0)
    class Meta:
        verbose_name = 'Category_小类表'

#动点表
class Mpoint(models.Model):
    id = models.IntegerField('id_点id',primary_key=True)
    type = models.CharField('type_类型',max_length=20,default='point')
    x = models.FloatField('x_横坐标',default=0)
    y = models.FloatField('y_纵坐标',default=0)
    rid = models.IntegerField('rid_对应人员',default=0)
    name = models.CharField('name_人员姓名',max_length=20,default='-')
    gid = models.IntegerField('gid_所属小类',default=0)
    class Meta:
        verbose_name = 'Mpoint_动点表'









#调度任务表
class Mession(models.Model):
    id = models.IntegerField('id_任务id',primary_key=True)
    title = models.CharField('title_任务简述',max_length=20,default='-')
    content = models.TextField('content',default='-')
    stime = models.CharField('stime_开始时间',max_length=50,default='-')
    ftime = models.CharField('ftime_结束时间',max_length=50,default='-')
    x = models.FloatField('x_横坐标',default=0)
    y = models.FloatField('y_纵坐标', default=0)
    mclass = models.CharField('mclass_任务类型',max_length=20,default='-')
    status = models.CharField('status_任务状态',max_length=20,default='_')
    mid = models.IntegerField('mid_管理员',default=0)
    rid = models.IntegerField('rid_护林员',default=0)
    class Meta:
        verbose_name = 'Mession_任务调度表'

#事件表
class Event(models.Model):
    id = models.IntegerField('id_事件id',primary_key=True)
    title = models.CharField('title_事件简述',max_length=20,default='-')
    content = models.TextField('content_事件详述',default='-')
    stime = models.CharField('stime_开始时间', max_length=50, default='-')
    ftime = models.CharField('ftime_结束时间', max_length=50, default='-')
    x = models.FloatField('x_横坐标', default=0)
    y = models.FloatField('y_纵坐标', default=0)
    handle = models.TextField('handle_事件处理情况描述',default='-')
    mclass = models.CharField('mclass_事件类型', max_length=20, default='-')
    status = models.CharField('status_事件状态', max_length=20, default='_')
    mid = models.IntegerField('mid_管理员', default=0)
    rid = models.IntegerField('rid_护林员', default=0)
    class Meta:
        verbose_name = 'Event_事件表'

#护林员日志
class Rjurnal(models.Model):
    id = models.IntegerField('id_日志id',primary_key=True)
    rid = models.IntegerField('rid_护林员',default=0)
    time = models.CharField('time_日志上传时间', max_length=50, default='-')
    content = models.TextField('content_日志内容', default='-')
    class Meta:
        verbose_name = 'Rjurnal_日志表'





#护林员调度轨迹
class Locus(models.Model):
    uid = models.IntegerField('uid_护林员id',primary_key=True)
    mfile = models.TextField('mfile_轨迹记录',default='{}')
    class Meta:
        verbose_name = 'Locus_轨迹记录'

#签到记录表
class Signin(models.Model):
    uid = models.IntegerField('uid_护林员id',primary_key=True)
    lfile = models.TextField('lfile_轨迹记录', default='[]')
    class Meta:
        verbose_name = 'Signin_签到记录'

#林区基础信息表
class Forest(models.Model):
    id = models.IntegerField('id_信息记录编号',primary_key=True)
    datee = models.CharField('date_日期',max_length=30,default='-')
    weather = models.TextField('weather_天气',default='-')
    area = models.CharField('area_区域',max_length=20,default='-')
    class Meta:
        verbose_name = 'Forest_林区基础信息表'







#新闻表
class News(models.Model):
    id = models.IntegerField('id_新闻id',primary_key=True)
    title = models.CharField('title_新闻标题', max_length=30, default='-')
    time = models.CharField('time_新闻发布时间', max_length=50, default='-')
    content = models.TextField('content_新闻内容', default='-')
    editer = models.CharField('editer_编辑者',max_length=20,default='=')
    class Meta:
        verbose_name = 'News_新闻表'

#警情记录
class Alert(models.Model):
    id = models.IntegerField('id_警情id', primary_key=True)
    time = models.CharField('time_警情发布时间', max_length=50, default='-')
    content = models.TextField('content_警情内容', default='-')
    aclass = models.CharField('aclass类型', max_length=20, default='-')
    afrom = models.CharField('afrom_警情内容',max_length=30,default='-')
    class Meta:
        verbose_name = 'Alert_警情记录'